<UserControl 
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:visualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    x:Class="Rage.Graph"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <ControlTemplate x:Key="InvisibleDataPointTemplate" TargetType="chartingToolkit:LineDataPoint">
            <Grid x:Name="Root" Opacity="0">
                <ToolTipService.ToolTip>
                    <ContentControl Content="{TemplateBinding FormattedDependentValue}" />
                </ToolTipService.ToolTip>
                <Ellipse Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" />
            </Grid>
        </ControlTemplate>
        <Style x:Key="LegendStyle" TargetType="visualizationToolkit:Legend">
            <Setter Property="Background">
                <Setter.Value>
                    <SolidColorBrush Color="Transparent" />
                </Setter.Value>
            </Setter>
            <Setter Property="BorderBrush">
                <Setter.Value>
                    <SolidColorBrush Color="Transparent" />
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="GraphStyle" TargetType="chartingToolkit:Chart">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="chartingToolkit:Chart">
                        <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="10">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <visualizationToolkit:Title Style="{TemplateBinding TitleStyle}" Content="{TemplateBinding Title}" />
                                <Grid Margin="0,15,0,15" Grid.Row="1">
                                    <chartingprimitives:EdgePanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch" x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}">
                                        <Grid Style="{TemplateBinding PlotAreaStyle}" Canvas.ZIndex="-1" />
                                        <Border Canvas.ZIndex="10" BorderBrush="#FF919191" BorderThickness="1" />
                                    </chartingprimitives:EdgePanel>
                                    <visualizationToolkit:Legend Margin="0,0,0,50" VerticalAlignment="Bottom" HorizontalAlignment="Right" x:Name="Legend" Style="{TemplateBinding LegendStyle}"/><!-- Title="{TemplateBinding LegendTitle}" -->
                                </Grid>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <chartingToolkit:Chart x:Name="Chart" Style="{StaticResource GraphStyle}" LegendStyle="{StaticResource LegendStyle}" MouseWheel="Chart_MouseWheel" />
    </Grid>
</UserControl>
